home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / ipdial / strreadargs.c < prev    next >
C/C++ Source or Header  |  1995-07-21  |  2KB  |  91 lines

  1. /**
  2. ***  IPDial     Script program for initializing a SLIP connection
  3. ***  Copyright  (C)   1994    Jochen Wiedmann
  4. ***
  5. ***  This program is free software; you can redistribute it and/or modify
  6. ***  it under the terms of the GNU General Public License as published by
  7. ***  the Free Software Foundation; either version 2 of the License, or
  8. ***  (at your option) any later version.
  9. ***
  10. ***  This program is distributed in the hope that it will be useful,
  11. ***  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ***  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. ***  GNU General Public License for more details.
  14. ***
  15. ***  You should have received a copy of the GNU General Public License
  16. ***  along with this program; if not, write to the Free Software
  17. ***  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ***
  19. ***
  20. ***
  21. ***  This file implements a version of ReadArgs(), which parses strings
  22. ***  instead of the command line. However, its data is static, you must
  23. ***  not use it twice at the same time.
  24. ***
  25. ***
  26. ***  Computer: Amiga 1200                       Compiler: Dice 3.01
  27. ***
  28. ***  Author:    Jochen Wiedmann
  29. ***             Am Eisteich 9
  30. ***             72555 Metzingen
  31. ***             Germany
  32. ***
  33. ***             Phone: (+0049) 7123 / 14881
  34. ***             Internet: wiedmann@neckar-alb.de
  35. **/
  36.  
  37.  
  38.  
  39.  
  40.  
  41. /**
  42. ***  Include files
  43. **/
  44. #ifndef IPDIAL_H
  45. #include "IPDial.h"
  46. #endif
  47. #include <dos/rdargs.h>
  48.  
  49.  
  50.  
  51.  
  52. /**
  53. ***  Local variables
  54. **/
  55. STATIC struct RDArgs *StrRDArgs     = NULL;
  56.  
  57.  
  58.  
  59.  
  60.  
  61. VOID StrReadArgsFree(VOID)
  62.  
  63. { if (StrRDArgs)
  64.   { FreeArgs(StrRDArgs);
  65.     StrRDArgs = NULL;
  66.   }
  67. }
  68.  
  69.  
  70.  
  71.  
  72.  
  73. ULONG StrReadArgs(STRPTR str, LONG *args, STRPTR template)
  74.  
  75. { STATIC struct RDArgs rdargs;
  76.  
  77.   StrReadArgsFree();
  78.  
  79.   rdargs.RDA_Source.CS_Buffer = str;
  80.   rdargs.RDA_Source.CS_Length = strlen((char *) str);
  81.   rdargs.RDA_Source.CS_CurChr = 0;
  82.   rdargs.RDA_DAList = 0;
  83.   rdargs.RDA_Buffer = NULL;
  84.   rdargs.RDA_BufSiz = 0;
  85.   rdargs.RDA_ExtHelp = NULL;
  86.   rdargs.RDA_Flags = RDAF_NOPROMPT;
  87.  
  88.   StrRDArgs = ReadArgs(template, args, &rdargs);
  89.   return((ULONG) (StrRDArgs ? TRUE : FALSE));
  90. }
  91.